package top.mcwebsite.playandroid.main.vm

import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.launch
import top.mcwebsite.playandroid.common.api.AppService
import top.mcwebsite.playandroid.lib.mvi.base.BaseViewModel
import top.mcwebsite.playandroid.lib.servicemanager.core.ServiceManager

class PlayAndroidAppViewModel : BaseViewModel<PlayAndroidAppIntent, PlayAndroidAppUiState, PlayAndroidAppUiEffect>(
    defaultState = PlayAndroidAppUiState()
) {

    init {
        viewModelScope.launch {
            ServiceManager.getService<AppService>().isDarkModeFlow().collect {
                if (it != null) {
                    setUiState { copy(isDarkMode = it) }
                }
            }
        }
    }
    override fun handleIntent(intent: PlayAndroidAppIntent) {

    }
}